
import { createForm } from '@formily/core';
import { Field, createSchemaField } from '@formily/react';
import 'antd/dist/antd.css';
import { Form, FormItem, Input } from '@formily/antd';
//纯JSX
const form = createForm();
const SchemaField = createSchemaField({
  components: {
    FormItem, Input
  }
});
const schema = {
  type: 'object',
  properties: {
    source: {
      title: '来源',
      type: 'string',
      required: true,
      'x-decorator': 'FormItem',
      'x-component': 'Input',
      'x-component-props': {
        'placeholder': '请输入'
      }
    },
    target: {
      title: '目标',
      type: 'string',
      'x-decorator': 'FormItem',
      'x-component': 'Input',
      'x-component-props': {
        'placeholder': '请输入'
      },
      'x-reactions': [
        {
          'dependencies': ['source'],
          'when': "{{$deps[0] == '123'}}",
          "fulfill": {
            'state': {
              visible: true
            }
          },
          "otherwise": {
            'state': {
              visible: false
            }
          }
        }
      ]
    }
  }
}
function App() {
  return (
    <Form form={form} labelCol={6} wrapperCol={5}>
      <SchemaField schema={schema} />
    </Form>
  )
}
export default App